package DesignPattern.NullObjectPattern;

//简单工厂+空对象模式
public class OperationFactory {
    public static Operation createOperation(String operator) {
        switch (operator) {
            case "add":
                return new AddOperation();
            case "subtract":
                return new SubtractOperation();
            case "multiply":
                return new MultiplyOperation();
            case "divide":
                return new DivideOperation();
            default:
                return new NullOperation();
        }
    }
}
